import API from './constant'
import request from '../utils/request'

export const getMessages = ({page = 1, pageSize = 5} ={}) => request({
  url: API.MESSAGES,
  method: 'GET',
  params: {
    page,
    pageSize
  }
})

export const addMessage = message => request({
  url: API.MESSAGES,
  method: 'POST',
  data: message
})

export const changeMessage = message => request({
  url: API.MESSAGES,
  method: 'PUT',
  data: message
})

export const DeleteMessage = _id => request({
  url: API.MESSAGES+'/'+_id,
  method: 'DELETE'
})